From f24e9a2cfae51d9762bed3eaa6db8b64029556c4 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Fri, 27 Feb 2004 08:25:56 +0000 Subject: [PATCH] fixed problem with updateTimestamp() altering existing IP blocks --- includes/Block.php | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/includes/Block.php b/includes/Block.php index 0f688a02c4..d98b07baeb 100644 --- a/includes/Block.php +++ b/includes/Block.php @@ -191,17 +191,19 @@ class Block return $this->mAddress != ""; } - function updateTimestamp() { - - $this->mTimestamp = wfTimestampNow(); - $this->mExpiry = Block::getAutoblockExpiry( $this->mTimestamp ); - - wfQuery( "UPDATE ipblocks SET " . - "ipb_timestamp='" . $this->mTimestamp . "', " . - "ipb_expiry='" . $this->mExpiry . "' " . - "WHERE ipb_address='" . wfStrencode( $this->mAddress ) . "'", DB_WRITE, "Block::updateTimestamp" ); - - $this->clearCache(); + function updateTimestamp() + { + if ( $this->mAuto ) { + $this->mTimestamp = wfTimestampNow(); + $this->mExpiry = Block::getAutoblockExpiry( $this->mTimestamp ); + + wfQuery( "UPDATE ipblocks SET " . + "ipb_timestamp='" . $this->mTimestamp . "', " . + "ipb_expiry='" . $this->mExpiry . "' " . + "WHERE ipb_address='" . wfStrencode( $this->mAddress ) . "'", DB_WRITE, "Block::updateTimestamp" ); + + $this->clearCache(); + } } /* private */ function clearCache() -- 2.20.1